const app = getApp();
const publicFun = require('/utils/public.js');
import { getClimateActionWithType } from '/utils/request'
Page({
  data: {},
  onLoad(options) {
    this.getClimateList(options.id);
  },
  async getClimateList(id) { 
    try{
      var params = {
        actiontypeid: app.globalData.actiontypeid,
        userid: 0,
        zhouqitype: 0
      }
      const res = await getClimateActionWithType(params)
      if(res.S == 1){
        if(res.L.length > 0){
          this.setData({
            typeList: res.L
          });

          my.pageScrollTo({
            selector: '.itemBox'+id,
            duration: 2000,
            offsetTop: -100
            // scrollTop: parseInt(this.data.scrollTop),
          });
        }
      }else{
        publicFun.showToast(res.M ? res.M : '加载失败');
      }
    }catch(e){
      publicFun.showToast('失败，请稍后再试')
    }
  },
});
